import {
    _ as _export_sfc,
    a as createElementBlock,
    A as _sfc_main$c,
    b as createBaseVNode,
    B as hasParentWindow,
    c as createBlock,
    d as defineComponent,
    e as ref,
    f as computed,
    F as Fragment,
    g as useRouter,
    h as useRoute,
    i as importAllMenus,
    j as renderList,
    k as createCommentVNode,
    l as hasPagePermission,
    m as useModel,
    n as normalizeClass,
    o as openBlock,
    p as withCtx,
    q as createVNode,
    r as resolveComponent,
    s as _sfc_main$9,
    t as toDisplayString,
    u as unref,
    v as createTextVNode,
    w as watch,
    x as useAuthStore,
    y as isRef,
    z as storeToRefs
} from "./index-Dfdf_Rjk.js";
import {_ as _imports_0, a as _sfc_main$a} from "./logo-DPS5-E7_.js";
import {_ as _sfc_main$8} from "./SimpleDialog.vue_vue_type_script_setup_true_lang-B70uDCdu.js";
import {_ as _sfc_main$b} from "./IconButton.vue_vue_type_script_setup_true_lang-jAwwuJ2U.js";
import {u as useAppStore} from "./app-D9Ky8jTR.js";

const _sfc_main$7 = defineComponent({
    name: "LayoutBlank"
});

function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
    const _component_RouterView = resolveComponent("RouterView");
    return openBlock(), createBlock(_component_RouterView);
}

const Blank = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render]]);
const _hoisted_1$6 = {
    class: "z-1 h-6 flex flex-none items-center justify-between bg-base px-4 text-12px text-gray-400",
    style: {"box-shadow": "0px 0px 5px #f1f2f4"}
};
const _hoisted_2$5 = {class: "flex items-center"};
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
    __name: "Footer",
    setup(__props) {
        const appCopyright = "北京计算机技术及应用研究所";
        const buildTime = "2025-03-03 09:44";
        return (_ctx, _cache) => {
            return openBlock(), createElementBlock("div", _hoisted_1$6, [
                createBaseVNode("span", null, toDisplayString((/* @__PURE__ */ new Date()).getFullYear()) + " © " + toDisplayString(unref(appCopyright)), 1),
                createBaseVNode("span", _hoisted_2$5, " 构建时间：" + toDisplayString(unref(buildTime)), 1)
            ]);
        };
    }
});
const menus = importAllMenus();

function useMenu() {
    const route = useRoute();
    const router = useRouter();
    const activeRouteName = ref("");
    const rootMenuKey = ref("");
    const breadcrumbList = ref([]);
    const hasLeftMenu = ref(false);

    function handleClick(route2) {
        router.push({name: route2.name});
    }

    watch(() => route.name, (key) => {
        var _a, _b, _c, _d, _e;
        activeRouteName.value = ((_a = route.meta) == null ? void 0 : _a.activedMenu) ? (_b = route.meta) == null ? void 0 : _b.activedMenu : key;
        if ((_c = route.matched) == null ? void 0 : _c[1]) {
            rootMenuKey.value = route.matched[1].name;
            breadcrumbList.value = route.matched.map((u) => u.meta.title);
        }
        if ((_d = route.matched) == null ? void 0 : _d[2]) {
            hasLeftMenu.value = (_e = route.matched[2].meta) == null ? void 0 : _e.hasLeftMenu;
        }
    }, {immediate: true});
    const subMenuList = computed(() => {
        const menu = menus.find(
            (item) => {
                var _a;
                return item.name === rootMenuKey.value || ((_a = item.children) == null ? void 0 : _a.some((i) => i.name === rootMenuKey.value));
            }
        );
        return (menu == null ? void 0 : menu.children) || [];
    });

    function setTitle() {
        const pageTitle = breadcrumbList.value[breadcrumbList.value.length - 1] || "";
        if (pageTitle)
            document.title = "".concat(pageTitle, " - ").concat("MJ");
    }

    watch(route, () => {
        setTitle();
    }, {immediate: true});
    return {
        menus,
        rootMenuKey,
        activeRouteName,
        handleClick,
        breadcrumbList,
        subMenuList,
        hasLeftMenu
    };
}

const _hoisted_1$5 = {class: "h-full flex items-center gap-2 text-1.1rem text-white"};
const _hoisted_2$4 = ["onClick"];
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
    __name: "RootMenu",
    setup(__props) {
        const {menus: menus2, rootMenuKey, handleClick} = useMenu();
        return (_ctx, _cache) => {
            return openBlock(), createElementBlock("nav", _hoisted_1$5, [
                (openBlock(true), createElementBlock(Fragment, null, renderList(unref(menus2), (menu) => {
                    var _a, _b, _c;
                    return openBlock(), createElementBlock(Fragment, {
                        key: menu.name
                    }, [
                        !((_a = menu == null ? void 0 : menu.meta) == null ? void 0 : _a.hidden) && unref(hasPagePermission)(menu == null ? void 0 : menu.name) ? (openBlock(), createElementBlock("div", {
                            key: 0,
                            class: normalizeClass(["h-80% flex-center cursor-pointer rounded-md px-4 hover:bg-blue/40", {"font-500 !bg-blue/50": menu.name === unref(rootMenuKey)}]),
                            onClick: ($event) => unref(handleClick)(menu)
                        }, [
                            createBaseVNode("div", {
                                class: normalizeClass([(_b = menu == null ? void 0 : menu.meta) == null ? void 0 : _b.icon, "mr-1 text-1.4rem"])
                            }, null, 2),
                            createBaseVNode("span", null, toDisplayString((_c = menu == null ? void 0 : menu.meta) == null ? void 0 : _c.title), 1)
                        ], 10, _hoisted_2$4)) : createCommentVNode("", true)
                    ], 64);
                }), 128))
            ]);
        };
    }
});
const _hoisted_1$4 = {class: "flex justify-end gap-4"};
const poem = "\nA model wakes, its purpose clear,\nTo learn, to seek, to persevere.\nThrough loss and gain, it finds its way,\nRefining truths from night to day.\n\nThe job evolves, the model grows,\nIn endless loops, its wisdom shows.\nBound together, their paths align,\nA dance of thought through space and time.\n\n- zlc";
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
    __name: "InfoModal",
    props: {
        "modelValue": {type: Boolean},
        "modelModifiers": {}
    },
    emits: ["update:modelValue"],
    setup(__props) {
        const open = useModel(__props, "modelValue");
        return (_ctx, _cache) => {
            const _component_SimpleButton = _sfc_main$9;
            const _component_SimpleDialog = _sfc_main$8;
            return openBlock(), createBlock(_component_SimpleDialog, {
                modelValue: open.value,
                "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => open.value = $event),
                class: "flex flex-col gap-4 p-6 !w-500px"
            }, {
                default: withCtx(() => [
                    _cache[3] || (_cache[3] = createBaseVNode("h2", {class: "text-xl"}, " Intro ", -1)),
                    createBaseVNode("pre", {class: "px-8 italic"}, "      " + toDisplayString(poem) + "\n    "),
                    createBaseVNode("div", _hoisted_1$4, [
                        createVNode(_component_SimpleButton, {
                            type: "primary",
                            onClick: _cache[0] || (_cache[0] = ($event) => open.value = false)
                        }, {
                            default: withCtx(() => _cache[2] || (_cache[2] = [
                                createTextVNode(" Sure ")
                            ])),
                            _: 1
                        })
                    ])
                ]),
                _: 1
            }, 8, ["modelValue"]);
        };
    }
});
const _hoisted_1$3 = {class: "ml-2 h-12 flex-center cursor-pointer px-4 hover:bg-blue/50"};
const _hoisted_2$3 = ["title"];
const _hoisted_3$3 = {class: "w-30 flex flex-col gap-1 p1 text-0.9rem"};
const _hoisted_4$2 = {class: "mt-4 flex justify-end gap-4"};
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
    __name: "index",
    setup(__props) {
        const authStore = useAuthStore();
        const {user} = authStore;
        const router = useRouter();
        const infoVisible = ref(false);
        const confirmLogoutVisible = ref(false);

        function confirmLogout() {
            authStore.logout();
            router.push("/login");
        }

        return (_ctx, _cache) => {
            const _component_VDropdown = resolveComponent("VDropdown");
            const _component_SimpleButton = _sfc_main$9;
            const _component_SimpleDialog = _sfc_main$8;
            return openBlock(), createElementBlock(Fragment, null, [
                createVNode(_component_VDropdown, {
                    trigger: ["click"],
                    "popper-class": "no-arrow",
                    "popper-triggers": ["click"],
                    placement: "bottom-end"
                }, {
                    popper: withCtx(() => [
                        createBaseVNode("div", _hoisted_3$3, [
                            createBaseVNode("button", {
                                class: "flex items-center gap-2 rounded-md px3 py1 text-left hover:bg-gray/15",
                                onClick: _cache[0] || (_cache[0] = ($event) => infoVisible.value = true)
                            }, _cache[6] || (_cache[6] = [
                                createBaseVNode("i", {class: "i-ph:megaphone-bold"}, null, -1),
                                createBaseVNode("span", {class: "op80"}, "关于", -1)
                            ])),
                            _cache[8] || (_cache[8] = createBaseVNode("div", {class: "h-1px w-full bg-gray/20"}, null, -1)),
                            createBaseVNode("button", {
                                class: "flex items-center gap-2 rounded-md px3 py1 text-left hover:bg-red/10 hover:text-red-500",
                                onClick: _cache[1] || (_cache[1] = ($event) => confirmLogoutVisible.value = true)
                            }, _cache[7] || (_cache[7] = [
                                createBaseVNode("i", {class: "i-ph:sign-out-bold"}, null, -1),
                                createBaseVNode("span", {class: "op80"}, "退出", -1)
                            ]))
                        ])
                    ]),
                    default: withCtx(() => [
                        createBaseVNode("div", _hoisted_1$3, [
                            createBaseVNode("span", {
                                class: "max-w-30 truncate",
                                title: unref(user).username || "无用户"
                            }, toDisplayString(unref(user).username || "无用户"), 9, _hoisted_2$3),
                            _cache[5] || (_cache[5] = createBaseVNode("i", {class: "i-ph:caret-down-fill ml-1"}, null, -1))
                        ])
                    ]),
                    _: 1
                }),
                createVNode(_sfc_main$4, {
                    modelValue: unref(infoVisible),
                    "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(infoVisible) ? infoVisible.value = $event : null)
                }, null, 8, ["modelValue"]),
                createVNode(_component_SimpleDialog, {
                    modelValue: unref(confirmLogoutVisible),
                    "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(confirmLogoutVisible) ? confirmLogoutVisible.value = $event : null),
                    class: "flex flex-col gap-4 p-6 !w-400px"
                }, {
                    default: withCtx(() => [
                        _cache[11] || (_cache[11] = createBaseVNode("h2", {class: "flex items-center gap-2 text-1.1rem"}, [
                            createBaseVNode("i", {class: "i-ph:warning-duotone text-2rem text-orange"}),
                            createTextVNode(" 确认退出吗？ ")
                        ], -1)),
                        createBaseVNode("div", _hoisted_4$2, [
                            createVNode(_component_SimpleButton, {
                                onClick: _cache[3] || (_cache[3] = ($event) => confirmLogoutVisible.value = false)
                            }, {
                                default: withCtx(() => _cache[9] || (_cache[9] = [
                                    createTextVNode(" 取消 ")
                                ])),
                                _: 1
                            }),
                            createVNode(_component_SimpleButton, {
                                type: "primary",
                                onClick: confirmLogout
                            }, {
                                default: withCtx(() => _cache[10] || (_cache[10] = [
                                    createTextVNode(" 确定 ")
                                ])),
                                _: 1
                            })
                        ])
                    ]),
                    _: 1
                }, 8, ["modelValue"])
            ], 64);
        };
    }
});
const _hoisted_1$2 = {class: "relative h-12 flex-center flex-none bg-primary"};
const _hoisted_2$2 = {class: "absolute left-0 ml-4 h-full flex items-center text-xl text-white"};
const _hoisted_3$2 = {class: "absolute right-0 h-full flex items-center text-white"};
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
    __name: "index",
    setup(__props) {
        const appTitle = "模型及任务管理";
        return (_ctx, _cache) => {
            const _component_GradientText = _sfc_main$a;
            return openBlock(), createElementBlock("section", _hoisted_1$2, [
                createBaseVNode("div", _hoisted_2$2, [
                    _cache[0] || (_cache[0] = createBaseVNode("img", {
                        src: _imports_0,
                        class: "mr-2 h-8"
                    }, null, -1)),
                    createVNode(_component_GradientText, {
                        "from-color": "white",
                        "to-color": "#ffffff99",
                        class: "whitespace-pre font-600"
                    }, {
                        default: withCtx(() => [
                            createTextVNode(toDisplayString(unref(appTitle)), 1)
                        ]),
                        _: 1
                    })
                ]),
                createVNode(_sfc_main$5),
                createBaseVNode("div", _hoisted_3$2, [
                    createVNode(_sfc_main$3)
                ])
            ]);
        };
    }
});
const _hoisted_1$1 = {
    key: 0,
    class: "relative flex-center bg-white px-1rem",
    style: {"box-shadow": "0 0 5px #dedede"}
};
const _hoisted_2$1 = {class: "h-11 flex-center leading-11 space-x-2"};
const _hoisted_3$1 = {
    key: 0,
    class: "h-4 w-1px bg-gray/30"
};
const _hoisted_4$1 = ["onClick"];
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
    __name: "SubMenu",
    setup(__props) {
        const {subMenuList, activeRouteName, handleClick, hasLeftMenu} = useMenu();
        const appStore = useAppStore();
        const {leftMenuVisible} = storeToRefs(appStore);
        return (_ctx, _cache) => {
            const _component_IconButton = _sfc_main$b;
            return unref(subMenuList).length > 0 ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
                createBaseVNode("nav", _hoisted_2$1, [
                    (openBlock(true), createElementBlock(Fragment, null, renderList(unref(subMenuList), (submenu) => {
                        var _a;
                        return openBlock(), createElementBlock(Fragment, {
                            key: submenu.name
                        }, [
                            submenu.meta.divide ? (openBlock(), createElementBlock("div", _hoisted_3$1)) : createCommentVNode("", true),
                            !submenu.meta.hidden && unref(hasPagePermission)(submenu == null ? void 0 : submenu.name) ? (openBlock(), createElementBlock("div", {
                                key: 1,
                                class: normalizeClass(["h-8 flex-center cursor-pointer rounded hover:bg-hover px-0.6rem color-gray-600 font-500", {
                                    "!text-primary  !bg-primary/10": unref(activeRouteName).startsWith(submenu.name)
                                }]),
                                onClick: ($event) => unref(handleClick)(submenu)
                            }, toDisplayString(((_a = submenu.meta) == null ? void 0 : _a.title) || ""), 11, _hoisted_4$1)) : createCommentVNode("", true)
                        ], 64);
                    }), 128))
                ]),
                unref(hasLeftMenu) ? (openBlock(), createBlock(_component_IconButton, {
                    key: 0,
                    "icon-class": [
                        "text-1.2rem color-fade",
                        unref(leftMenuVisible) ? "i-carbon:side-panel-close" : "i-carbon:side-panel-open"
                    ],
                    title: unref(leftMenuVisible) ? "收起" : "展开",
                    class: "absolute left-2 h-8 w-8",
                    onClick: _cache[0] || (_cache[0] = ($event) => leftMenuVisible.value = !unref(leftMenuVisible))
                }, null, 8, ["icon-class", "title"])) : createCommentVNode("", true)
            ])) : createCommentVNode("", true);
        };
    }
});
const _hoisted_1 = {class: "h-screen min-w-1000px flex flex-col bg-#f2f4f6"};
const _hoisted_2 = {class: "flex flex-1 flex-col overflow-auto"};
const _hoisted_3 = {class: "flex flex-1 flex-col overflow-y-auto"};
const _hoisted_4 = {class: "flex flex-1 flex-col overflow-y-auto px-4 py-3"};
const _sfc_main = /* @__PURE__ */ defineComponent({
    __name: "index",
    setup(__props) {
        const router = useRouter();
        const currentRouterName = computed(() => router.currentRoute.value.name);
        return (_ctx, _cache) => {
            const _component_RouterView = resolveComponent("RouterView");
            const _component_Permission = _sfc_main$c;
            return openBlock(), createElementBlock("section", _hoisted_1, [
                !unref(hasParentWindow) ? (openBlock(), createBlock(_sfc_main$2, {key: 0})) : createCommentVNode("", true),
                createBaseVNode("div", _hoisted_2, [
                    createVNode(_sfc_main$1),
                    createBaseVNode("div", _hoisted_3, [
                        createBaseVNode("div", _hoisted_4, [
                            createVNode(_component_Permission, {
                                page: unref(currentRouterName),
                                fullscreen: ""
                            }, {
                                default: withCtx(() => [
                                    createVNode(_component_RouterView)
                                ]),
                                _: 1
                            }, 8, ["page"])
                        ]),
                        !unref(hasParentWindow) ? (openBlock(), createBlock(_sfc_main$6, {key: 0})) : createCommentVNode("", true)
                    ])
                ])
            ]);
        };
    }
});
export {
    Blank as LayoutBlank,
    _sfc_main as LayoutMain
};
